<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<img id="img" src="./9.jpg" width="800" height="600" style="display: none" alt="">
<canvas id="player" width="800px" height="600px"></canvas>

<script>
  let num=9;
  let imgsrc="./10.jpg";
  function playerImg(){
    imgsrc="./"+num+".jpg";
    document.getElementById("img").setAttribute("src",imgsrc);
    let imgs=document.getElementById("img");
    let canvas=document.getElementById("player");
    let ctx=canvas.getContext('2d');
    ctx.drawImage(imgs,0,0,800,600);
    if(num===9){
      num=10;
    }
    else if(num===10){
      num=9;
    }
    // document.getElementById("img").setAttribute("src",imgsrc);
  }
  setInterval(playerImg,50)


</script>

</body>
</html>
